# 1. 两数之和
# def twoSum(self, nums, target):
#   for index in range(len(nums)):
#     for index2 in range(index+1,len(nums)):
#       if nums[index]+nums[index2]==target:
#         return [index,index2]
#   return []
def twoSum(self, nums, target):
  map={}
  for index in range(len(nums)):
    if target-nums[index] in map:
      return [index,map[target-nums[index]]]
    else:
      map.setdefault(nums[index],index)
  return []